﻿using System;
using System.IO;

namespace Aeon.Emulator
{
    /// <summary>
    /// Defines a virtual device for an emulated machine.
    /// </summary>
    public interface IVirtualDevice : IDisposable
    {
        #region Methods
        /// <summary>
        /// Invoked when the emulator enters a paused state.
        /// </summary>
        void Pause();
        /// <summary>
        /// Invoked when the emulator resumes from a paused state.
        /// </summary>
        void Resume();
        /// <summary>
        /// Invoked when the virtual device has been added to a VirtualMachine.
        /// </summary>
        /// <param name="vm">VirtualMachine which owns the device.</param>
        void DeviceRegistered(VirtualMachine vm);
        /// <summary>
        /// Invoked when the device should save its current state to a <see cref="System.IO.Stream"/>.
        /// </summary>
        /// <param name="destination"><see cref="System.IO.Stream"/> to which the state is saved.</param>
        void SaveCurrentState(Stream destination);
        /// <summary>
        /// Invoked when the device should restore its state from a <see cref="System.IO.Stream"/>.
        /// </summary>
        /// <param name="source"><see cref="System.IO.Stream"/> from which the state is restored.</param>
        void RestoreState(Stream source);
        #endregion
    }
}
